package org.pupil.common;

import java.util.Objects;

/**
 * @Description: 服务资源定位符
 * @Author: pupil
 * @Date: 2024/07/10 下午 4:15
 */
public class URL {

    private String IP; // ip地址
    private Integer port; // 端口
    private String serviceName; // 服务名
    private String version; // 版本

    public URL() {
    }

    public URL(String IP, Integer port) {
        this.IP = IP;
        this.port = port;
    }

    public String getIP() {
        return IP;
    }

    public void setIP(String IP) {
        this.IP = IP;
    }

    public Integer getPort() {
        return port;
    }

    public void setPort(Integer port) {
        this.port = port;
    }

    public String getServiceName() {
        return serviceName;
    }

    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        URL url = (URL) o;
        return Objects.equals(IP, url.IP) && Objects.equals(port, url.port);
    }

    @Override
    public int hashCode() {
        return Objects.hash(IP, port);
    }
}
